package utilcollection;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> a1=new ArrayList<String>();

        System.out.println("Initial size of al: "+a1.size());

        a1.add("C");
        a1.add("B");
        a1.add("A");
        a1.add("D");
        a1.add("E");
        a1.add(1,"H");
        System.out.println("Size of a1 after additions: "+a1.size());
        System.out.println("Contents of a1: "+a1);

        ListIterator<String> listIterator=a1.listIterator();

        a1.set(1,"A");
        System.out.println(a1);


        String s[]=new String[a1.size()];
        s=a1.toArray(s);

        for (String s1 :s) {
            System.out.println(s1);
        }

        List<String> list=new ArrayList<String>();
        list=Collections.nCopies(4,"word");
        System.out.println(list);



    }
}
